﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Validation.aspx.cs" Inherits="BackboneJs_pluralsight_Validation" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../../Scripts/jquery-2.0.0.min.js" type="text/javascript"></script>
    <script src="../../Scripts/underscore.js" type="text/javascript"></script>
    <script src="../../Scripts/backbone.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    </div>
    <script type="text/javascript">
        var Vehicule = Backbone.Model.extend({
            validate: function (attrs) {
                var validColors = [];
                var isValidColors = function (attribs) {
                    return false;
                };

                if (isValidColors(attrs) == false) {
                    console.log('invalid color');
                    return false;
                }
                return true;
            }
        });

            var car = new Vehicule();
            car.on('invalid', function (model, error) {
                console.log(error);
                return false;
            });
            car.set('t', 'valid');
    </script>
    </form>
</body>
</html>
